﻿using UnityEngine;

namespace huqiang.Render
{
    interface MaterialBlockSetter
    {
        void SetBlock(MaterialPropertyBlock block);
    }
    public class FloatBlock : MaterialBlockSetter
    {
        public string name;
        public float value;

        public void SetBlock(MaterialPropertyBlock block)
        {
            block.SetFloat(name, value);
        }
    }
    public class IntBlock : MaterialBlockSetter
    {
        public string name;
        public int value;
        public void SetBlock(MaterialPropertyBlock block)
        {
            block.SetInt(name, value);
        }
    }
    public class ColorBlock : MaterialBlockSetter
    {
        public string name;
        public Color value;
        public void SetBlock(MaterialPropertyBlock block)
        {
            block.SetColor(name, value);
        }
    }
    public class VectorBlock : MaterialBlockSetter
    {
        public string name;
        public Vector4 value;
        public void SetBlock(MaterialPropertyBlock block)
        {
            block.SetVector(name, value);
        }
    }
    public class MatrixBlock : MaterialBlockSetter
    {
        public string name;
        public Matrix4x4 value;
        public void SetBlock(MaterialPropertyBlock block)
        {
            block.SetMatrix(name, value);
        }
    }
    public class FloatArrayBlock : MaterialBlockSetter
    {
        public string name;
        public float[] value;
        public void SetBlock(MaterialPropertyBlock block)
        {
            block.SetFloatArray(name, value);
        }
    }
    public class TextureBlock : MaterialBlockSetter
    {
        public string name;
        public Texture value;
        public void SetBlock(MaterialPropertyBlock block)
        {
            block.SetTexture(name, value);
        }
    }
}
